#include <bits/stdc++.h>
using namespace std;
int sum[(int)1e5 + 3], len, ans = 0x7fffffff;
char str[(int) 1e5 + 3];
int main() { 
    freopen("reverse.in", "r", stdin);
    freopen("reverse.out", "w", stdout);
    scanf("%s", str + 1);
    len = strlen(str + 1);
    for (int i = 1; i <= len; i++) 
        sum[i] = sum[i - 1] + (str[i] == '1');
    for (int i = 1; i <= len + 1; i++)  // '|' is (i - 1)
        ans = min(ans, sum[i - 1] + (len - i + 1 - (sum[len] - sum[i - 1])));
    cout << ans;
}
